<%@ include file="/WEB-INF/jsp/include/taglib.jsp" %>

<table border="1">
    <tr>
        <td>
            <a href="<c:url value="/viewentry.form/${entry.id}"/>">
                <c:if test="${not (entry.author == null)}">
                    <c:out value="${entry.author.fullname}"/>
                    (
                    <c:out value="${entry.author.username}"/>
                    )
                    :
                </c:if>
                <c:out value="${entry.header}"/>
                / <i>
                <fmt:formatDate value="${entry.date}"/>
                <authz:authorize ifAnyGranted="ROLE_SUPERVISOR">
                    (
                    <c:out value="${entry.ip}" default="no ip logged"/>
                    )
                </authz:authorize>
            </i></a></td>
    </tr>
    <tr>
        <td>
            <c:out value="${entry.text}"/>
        </td>
    </tr>
    <tr>
        <td>
            Buddyz on ride:<br>
            <c:forEach items="${entry.rideJoinComments}" var="comment">
                <c:out value="${comment.author.fullName} (${comment.author.username})"/>
                <br>
            </c:forEach>
        </td>
    </tr>
    <tr>
        <td>
            <c:forEach items="${entry.pictures}" var="photo">
                <a href="<c:url value="/viewpicture.form/${photo.id}"/>">
                    <img src="<c:url value="/images/${photo.thumbnailPath}"/>"/><br/>
                </a>
                <c:if test="${entry:isPictureOwner(photo, pageContext.request.remoteUser)}">
                    <a href="<c:url value="/editpicture.form/${photo.id}"/>">Edit</a><br/>
                    <a href="<c:url value="/deletepicture.form/${photo.id}"/>">Delete</a><br/>
                </c:if>
            </c:forEach>
        </td>
    </tr>
    <tr>
        <td>
            <c:if test="${entry:isAllowedEditing(entry, pageContext.request.remoteUser)}">
                <a href="<c:url value="/editentry.form/${entry.id}"/>">Edit Entry/Add
                    Photos</a> ..
            </c:if>
            <c:choose>
                <c:when test="${entry:isUserOnRide(entry, pageContext.request.remoteUser)}">
                    <a href="<c:url value="/splitride.form/${entry.id}"/>">Split Ride</a>
                </c:when>
                <c:otherwise>
                    <a href="<c:url value="/joinride.form/${entry.id}"/>">Join Ride</a>
                </c:otherwise>
            </c:choose>
        </td>
    </tr>
</table>
